package com.daikuan.lizh.utils;

import java.text.DecimalFormat;

/**
 * Created by jiming1 on 2017/3/9.
 */
public class StringUtils {

    public static String formatTime(long mills) {

        long dayMills = 24 * 60 * 60 * 1000;
        long hourMills = 60 * 60 * 1000;
        long minuteMills = 60 * 1000;
        long secondMills = 1000;

        long days = mills / dayMills;
        mills %= dayMills;
        long hours = mills / hourMills;
        mills %= hourMills;
        long minutes = mills / minuteMills;
        mills %= minuteMills;
        long seconds = mills / secondMills;

        return ((days < 10) ? "0" + days : "" + days) + ":"
                + ((hours < 10) ? "0" + hours : "" + hours) + ":"
                + ((minutes < 10) ? "0" + minutes : "" + minutes) + ":"
                + ((seconds < 10) ? "0" + seconds : "" + seconds);
    }

    public static String getMoney(float money) {
        return new DecimalFormat("##0.00").format(money);
    }
}
